<template>
  <div class="search">
    <div class="container">
      <div class="title">首页 > 企业账号> 公司信息</div>
      <div class="message-box">
        <div class="input-list">
          <div class="text">
            <div class="caption">公司信息状态：</div>
            <div class="details state" v-if="ruleForm.status === 0">待审核</div>
            <div class="details state" v-else>审核不通过</div>
          </div>
          <div class="text" v-if="ruleForm.status === 2">
            <div class="caption cause">原因：</div>
            <div class="details word-break" v-text="ruleForm.context">企业信用代码与公司名称对不上</div>
          </div>
          <div class="text">
            <div class="caption behalf">公司名称：</div>
            <div class="details" v-text="ruleForm.companyName">深圳阿奇数科技有限公司</div>
          </div>
          <div class="text">
            <div class="caption">公司信用代码：</div>
            <div class="details" v-text="ruleForm.companyCode">深圳阿奇数科技有限公司</div>
          </div>
          <div class="text">
            <div class="caption behalf">法人代表：</div>
            <div class="details" v-text="ruleForm.corporateName">未设置/李四</div>
          </div>
          <div class="text">
            <div class="caption">公司注册地址：</div>
            <div class="details" v-text="ruleForm.companyAddress">广东省广州市天河区棠下</div>
          </div>
          <div class="btn">
            <button class="back" @click="goBack">返回</button>
            <button class="commit" v-if="ruleForm.status === 2" @click="reApply">申请修改企业信息</button>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { getCompanyApplyRecord } from '@/api/account-info/business'
export default {
  components: {},
  data() {
    return {
      ruleForm: {
        companyName: '',
        companyCode: '',
        corporateName: '',
        context: '',
        status: 0
      }
    }
  },
  created() {
    this.getInfo()
  },
  methods: {
    // 获取最近一次申请修改的公司信息
    getInfo() {
      getCompanyApplyRecord().then(response => {
        if (response.data) {
          this.ruleForm = response.data
        }
      })
    },
    // 重新申请
    reApply() {
      this.$emit('setStatus', 1)
    },
    // 返回
    goBack() {
      this.$router.push('/base-info-set')
    }
  }
}
</script>

<style lang='scss' scoped >
.search {
  background: #f5f5f5;
  .container {
    .title{
        color: #707070;
        font-size: 12px;
        margin: 10px 0 ;
    }
    .message-box {
      background: #ffffff;
      .input-list{
          display: flex;
          flex-direction: column;
          align-items: center;
          margin-bottom: 60px;
          padding: 108px 0 165px 0;
          line-height: 40px;
          .text{
              display: flex;
              .details{
                  width: 200px;
              }
              .behalf{
                  padding-left: 27px;
              }
              .caption{
                  color: #6B6B6B;
              }
              .state{
                  color: #FC8A41;
              }
              .cause{
                  padding-left: 55px;
              }
          }
          .btn{
              margin-top: 30px;
              padding-left: 197px;
              .back{
                width: 110px;
                height: 37px;
                background: #F5F5F5;
                border: 1px solid #E5E5E5;
                color: #3D3D3D;
                text-align: center;
                line-height: 37px;
                cursor: pointer;
                border-radius: 3px;
                margin-right: 10px;
              }
              .commit{
                width: 180px;
                height: 37px;
                background:#FF3B30;
                //   border: 1px solid #E5E5E5;
                border-radius: 3px;
                color:#ffffff;
                font-size: 16px;
                text-align: center;
                line-height: 37px;
                cursor: pointer;
              }
          }
      }
    }

  }
  /deep/ .input-list{
      .el-input{
          width: 270px;
          height: 35px;
          .el-input__inner{
              height: 35px;
          }
      }
  }
  /deep/ .site{
      .el-form-item__label{
          width: 122px ! important;

      }
      .el-form-item__error{
              padding-left: 22px;
          }
  }
  /deep/ .credit{
      .el-form-item__label{
          width: 122px ! important;
      }
      .el-form-item__error{
              padding-left: 22px;
          }
  }

//   el-form-item__error
}
</style>
